package com.phiture.erp.produce.dal.mapper;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.phiture.erp.produce.dal.entity.BomGroupStandardDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

/**
 * bom分组 Mapper
 *
 * @author lekailehuai
 */
@Mapper
public interface BomGroupStandardMapper extends BaseMapperX<BomGroupStandardDO> {

    default List<BomGroupStandardDO> selectList(String name, String number, String description, String simplename) {
        return selectList(new LambdaQueryWrapperX<BomGroupStandardDO>()
                .likeIfPresent(BomGroupStandardDO::getName, name)
                .eqIfPresent(BomGroupStandardDO::getNumber, number)
                .eqIfPresent(BomGroupStandardDO::getDescription, description)
                .likeIfPresent(BomGroupStandardDO::getSimplename, simplename)
                .orderByDesc(BomGroupStandardDO::getId));
    }

	default BomGroupStandardDO selectByParentidAndName(Long parentid, String name) {
	    return selectOne(BomGroupStandardDO::getParentid, parentid, BomGroupStandardDO::getName, name);
	}

    default Long selectCountByParentid(Long parentid) {
        return selectCount(BomGroupStandardDO::getParentid, parentid);
    }

}